# 安装rz⼯具
apt install lrzsz

# 解压 shardingsphere
tar -zxvf apache-shardingsphere-5.3.2-shardingsphere-proxy-bin.tar.gz

# 重命名⽬录
mv apache-shardingsphere-5.3.2-shardingsphere-proxy-bin shardingsphere-proxy

# 安装JAVA运⾏时环境，JRE 
apt-get update
apt install openjdk-17-jre-headless
apt install openjdk-17-jdk

# 安装ShardingSphere镜像并启动容器
# 指定JVM参数：
# -e JJVM_OPTS="-Xms256m -Xmx256m -Xmn128m" 初始堆内存256m,量⼤堆内存256m,新⽣代内存128m 
# 指定端⼝号：
# -e PORT=3308 端⼝号为3308 
docker run -d \
-p 3307:3307 \
-v /bit/shardingsphere/proxy/conf:/opt/shardingsphere-proxy/conf \
-v /bit/shardingsphere/proxy/ext-lib:/opt/shardingsphere-proxy/ext-lib \
-v /bit/shardingsphere/proxy/logs:/opt/shardingsphere-proxy/logs \
-e JVM_OPTS="-Xms256m -Xmx256m -Xmn128m" \
--name ss-proxy \
apache/shardingsphere-proxy:5.3.2

# 查看容器日志
docker logs ss-proxy

# 启动 docker 容器
docker start ss-proxy

# 进入 docker 容器
docker exec -it ss-proxy env LANG=C.UTF-8 /bin/bash

# 查看ShardingSphere的实时⽇志
tail -f /opt/shardingsphere-proxy/logs/stdout.log


